#include <myhead.h>
int main(int argc, const char *argv[])
{
	//1、创建套接字
	int C=socket(AF_INET,SOCK_DGRAM,0);
	if(-1==C){perror("创建套接字失败");return -1;}
	//2、绑定服务器
	struct sockaddr_in addr={0};
	addr.sin_family=AF_INET;
	addr.sin_port=htons(12354);
	addr.sin_addr.s_addr=inet_addr("127.0.0.1");
	if(connect(C,(const struct sockaddr*)&addr,sizeof(addr))==-1){perror("绑定失败\n");return -1;}
	while(1)
	{
		char buf[128]={0};
		printf("请输入:");
		scanf("%127s",buf);
		while(getchar()!=10);
		printf("发送\n");
		int res = send(C,buf,strlen(buf),0);
		printf("接收\n");
		//recv(C,buf,128,0);
		//printf("接收服务器端消息为%s\n",buf);
	}
	return 0;
}
